#include "setupRC.h"
#include "myConstants.h"
#include "JetPlane.h"
#include "Floor.h"

#include "GLTools.h"
#include "GLShaderManager.h"
#include "GLTriangleBatch.h"
#include "GLBatch.h"
#include "GLFrame.h"

#include <cstdlib>

GLShaderManager shaderManager; // Shader Manager
GLTriangleBatch sphereBatch;
GLFrame spheres[NUM_SPHERES];

//////////////////////////////////////////////////////////////////
// This function does any needed initialization on the rendering
// context. 
void setupRC() {
	shaderManager.InitializeStockShaders();

	glEnable(GL_DEPTH_TEST);

	//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

	// enable antialiasing
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_LINE_SMOOTH); // Smooth out lines

	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);


	// This make a sphere
	gltMakeSphere(sphereBatch, 0.5f, 26, 13);
	//gltMakeCylinder(sphereBatch, 0.5f, 0.2f, 2.0f, 30, 20);
	//gltMakeDisk(sphereBatch, 0.3f, 0.7f, 20, 40);

	// Randomly place the spheres
	for(int i = 0; i < NUM_SPHERES; i++) {
		GLfloat x = ((GLfloat)((rand() % 400) - 200) * 0.1f);
		GLfloat z = ((GLfloat)((rand() % 400) - 200) * 0.1f);
		spheres[i].SetOrigin(x, 0.0f, z);
	}
}
